﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Castle.ActiveRecord;
using System.ComponentModel.DataAnnotations;

namespace ZDSoft.QLMS.Entity.SystemSetting
{
    [ActiveRecord]
    public class Role : EntityBase<Role>
    {
        /// <summary>
        /// 角色
        /// </summary>
        [Property]
        public string RoleName { get; set; }

        /// <summary>
        /// 是否可用
        /// </summary>
        [Property]
        public bool IsActive { get; set; }

        /// <summary>
        /// 当前角色拥有的账户
        /// </summary>
        [HasAndBelongsToMany(typeof(User), Table = "SystemUser_Role", ColumnRef = "UserID", ColumnKey = "RoleID")]
        public IList<User> Users { get; set; }

        /// <summary>
        /// 当前角色可操作的功能
        /// </summary>
        [HasAndBelongsToMany(typeof(SystemFunction), Table = "Role_SystemFunction", ColumnRef = "FunctionID", ColumnKey = "RoleID")]
        public IList<SystemFunction> SystemFunctions { get; set; }
    }
}
